# -*- coding: utf-8 -*-
# __init__.py create by kumiler
# on 2022/1/10 11:39
# desc

from utils.operators.spark_submit import SparkSubmitOperator
from jms.dim.dim_lmdm_sys_customer import jms_dim__dim_lmdm_sys_customer
from jms.dim.dim_lmdm_sys_network_expand import jms_dim__dim_lmdm_sys_network_expand
from jms.dwd.oms.dwd_yl_oms_oms_waybill_incre_dt import jms_dwd__dwd_yl_oms_oms_waybill_incre_dt

jms_dws__dws_customer_ticket_quantity_dt = SparkSubmitOperator(
    task_id='jms_dws__dws_customer_ticket_quantity_dt',
    email=['lukunming@jtexpress.com','yl_bigdata@yl-scm.com'],
    pool_slots=2,
    # depends_on_past=True,  # 如果任务依赖于前一天的同名任务，则将 depends_on_past 设为 True
    task_concurrency=1,  # 如果任务不支持并发，则将 task_concurrency 设为 1
    name='jms_dws__dws_customer_ticket_quantity_dt_{{ execution_date | date_add(1) | cst_ds }}',  # yarn 任务名称
    driver_memory='2G' , 
    executor_memory='2G' , 
    executor_cores=2 , 
    num_executors=3 , 
    conf={
        'spark.executor.memoryOverhead'             : '2048' , 
          'spark.core.connection.ack.wait.timeout': 300,
          'spark.default.parallelism': 600,
          'spark.locality.wait': 60,
          },
    jars='hdfs:///scheduler/jms/spark/lkm/report/dws_customer_ticket_quantity_dt/common-1.0-SNAPSHOT.jar',  # 依赖 jar 包
    java_class='com.yunlu.bigdata.jobs.report.CursomerTicketsStatistics',  # spark 主类
    application='hdfs:///scheduler/jms/spark/lkm/report/dws_customer_ticket_quantity_dt/original-jobs-1.0-SNAPSHOT.jar',  # spark jar 包
    application_args=['{{ execution_date  | cst_ds }}'],  # 参数dt 2020-10-26
)

# 设置依赖
jms_dws__dws_customer_ticket_quantity_dt << [
    jms_dim__dim_lmdm_sys_customer,
    jms_dim__dim_lmdm_sys_network_expand,
    jms_dwd__dwd_yl_oms_oms_waybill_incre_dt,
]